new Vue({
    el:'#app',
    data: {
        goodslist:[],  //将从后端得到的数据存放在data中，以便于前端显示
        typelist:[],
        eid:"",
        goodname:"",
    },
    created(){

        axios({
            method:'get', //post
            url: 'http://47.94.138.204:7790/goods/searchgoods',
            params:{
                // 得到的数据以json类型存放
            },
        }).then((res)=>{
            let result = res.data
            console.log(result)
            this.goodslist = result;
        })


        axios({
            method:'get', //post
            url: 'http://47.94.138.204:7790/example/alltype',
            params:{
                // 得到的数据以json类型存放
            },
        }).then((res)=>{
            let result = res.data
            console.log(result)
            this.typelist = result;
        })
    },
    methods:{
        searchGoods:function (){
            let goodname = this.goodname;
            axios({
                method:'get', //post
                url: 'http://47.94.138.204:7790/example/alltype',
                params:{
                    // 得到的数据以json类型存放
                    goodname:goodname,
                },
            }).then((res)=>{
                let result = res.data
                console.log(result)
                this.typelist = result;


            })
        },
        gooddetail:function (sid,eid){
            window.location.href = "goodsdetail.html?gid=" + sid + "&uid=6&sid="+eid;
        },

    },


})


var layer
$(function ()
{
    layui.use(['form'],function (args){
        layer=layui.layer;
    });
})
